import React from 'react'
import { Row } from 'antd'
import { FormInstance, FormLayout } from 'antd/lib/form/Form'
import { SchemaTypeItem, SchemaItem } from '../index'

import WidgetsRender from './WidgetsRender'

interface Props {
  schemas: SchemaItem[]
  formInstance:FormInstance
  layout: FormLayout
  row?: SchemaTypeItem['row']
  onFinish: (values: Object) => void
}

function index({layout, row, ...reset}: Props) {
  return (
    <>
      {layout === 'inline' ? (
        <WidgetsRender layout={layout} row={row} {...reset} />
      ) : (
        <Row {...row}>
          <WidgetsRender
            layout={layout}
            row={row}
            {...reset}
          />
        </Row>
      )}
    </>
  )
}
export default index
